<div id="breadcrumbs"><?php echo $this->Html->link('Home', array('controller' => 'contents', 'action' => 'view', 'home')); ?> > <?php echo $this->Html->link('List Categories', array('controller'=>'Catagories', 'action'=>'index'));?> > <?php echo $catagory['Catagory']['cat_name']?> 
</div>

<?php if($this->Session->read('Auth.User')){ ?>
<?php if ($this->Session->read('Auth.User.role_id') == 1 || $this->Session->read('Auth.User.role_id') == 2) { ?>
<div class="catagories view">
<?php } ?>
    
<h2><?php  echo __('Category'); ?></h2>
<table>

    <tr>
        <th>
            <?php echo __('Category'); ?>
        </th>
        <td>
            <?php echo h($catagory['Catagory']['cat_name']); ?>
        </td>
    </tr>
    <tr>
        <th>
            <?php echo __('Description'); ?>
        </th>
        <td>
            <?php echo h($catagory['Catagory']['cat_desc']); ?>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <h3><?php echo __('Content'); ?></h3>
            <?php echo html_entity_decode($catagory['Catagory']['content']); ?>
        </td>
    </tr>
</table>

 <?php if($this->Session->read('Auth.User.role_id')==1 || $this->Session->read('Auth.User.role_id')==2){?>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Edit Category'), array('action' => 'edit', $catagory['Catagory']['cat_id'])); ?> </li>
		<li><?php echo $this->Form->postLink(__('Delete Category'), array('action' => 'delete', $catagory['Catagory']['cat_id']), null, __('Are you sure you want to delete %s?', $catagory['Catagory']['cat_name'])); ?> </li>
		<li><?php echo $this->Html->link(__('List Categories'), array('action' => 'index')); ?> </li>
	</ul>
</div>
<?php 
 }
 ?>
<div class="related">
	<h3><?php echo __('Related Resources'); ?></h3>
	<?php if (!empty($catagory['Resource'])): ?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>		
		<th><?php echo __('Resource'); ?></th>
		<th><?php echo __('Desciption'); ?></th>
		<th>View</th>
                 <?php if($this->Session->read('Auth.User.role_id')==1 || $this->Session->read('Auth.User.role_id')==2){?>
                <th>Edit</th>
                <th>Delete</th>
                 <?php } ?>
	</tr>
	<?php
		$i = 0;
		foreach ($catagory['Resource'] as $resource): ?>
		<tr>
			<td><?php echo $resource['res_name']; ?></td>
			<td><?php echo $resource['res_desc']; ?></td>
                        <td><?php echo $this->Html->image('view.png',array('alt'=>'View','url'=>array('controller' => 'resources', 'action' => 'view', $resource['res_id']))); ?></td>
                         <?php if($this->Session->read('Auth.User.role_id')==1 || $this->Session->read('Auth.User.role_id')==2){?>
                        <td><?php echo $this->Html->image('edit.png',array('alt'=>'Edit','url'=>array('controller' => 'resources', 'action' => 'edit', $resource['res_id']))); ?></td>
                        <td><?php echo $this->Form->postLink($this->Html->image('delete.png', array('alt'=>__('Delete'))), array('controller' => 'resources', 'action' => 'delete', $resource['res_id']), array('escape' =>false, 'confirm'=>__('Are you sure you want to delete '. $resource['res_name']. '?'))); ?></td>
                         <?php } ?>
		</tr>
	<?php endforeach; ?>
	</table>
    <?php endif; ?>
</div>
    <?PHP }else{
    ?>
<div>
    <div>
        <br>
    <?php echo html_entity_decode($catagory['Catagory']['content']); ?>
</div>
</div>
    <?php  
     } ?>

